/* tmclilib.h
 * TM client C API library functions and tokens.
 * Copyright (c) 2004 Ladybridge Systems, All Rights Reserved
 */

/* Function definitions */

#ifdef __BORLANDC__
   /* Borland C compiler for Windows users */
   #define DLLEntry __declspec(dllimport)
#endif

#ifdef _MSC_VER
   /* Microsoft C compiler for Windows users */
   #define DLLEntry __declspec(dllimport)

   #define TMCall _TMCall
   #define TMChange _TMChange
   #define TMClearSelect _TMClearSelect
   #define TMClose _TMClose
   #define TMConnect _TMConnect
   #define TMConnected _TMConnected
   #define TMConnectLocal _TMConnectLocal
   #define TMDisconnect _TMDisconnect
   #define TMDisconnectAll _TMDisconnectAll
   #define TMDcount _TMDcount
   #define TMDel _TMDel
   #define TMDelete _TMDelete
   #define TMDeleteu _TMDeleteu
   #define TMEndCommand _TMEndCommand
   #define TMError _TMError
   #define TMExecute _TMExecute
   #define TMExtract _TMExtract
   #define TMField _TMField
   #define TMFree _TMFree
   #define TMGetSession _TMGetSession
   #define TMIns _TMIns
   #define TMLocate _TMLocate
   #define TMMarkMapping _TMMarkMapping
   #define TMMatch _TMMatch
   #define TMMatchfield _TMMatchfield
   #define TMOpen _TMOpen
   #define TMRead _TMRead
   #define TMReadl _TMReadl
   #define TMReadList _TMReadList
   #define TMReadNext _TMReadNext
   #define TMReadu _TMReadu
   #define TMRelease _TMRelease
   #define TMReplace _TMReplace
   #define TMRespond _TMRespond
   #define TMSelect _TMSelect
   #define TMSelectIndex _TMSelectIndex
   #define TMSelectLeft _TMSelectLeft
   #define TMSelectRight _TMSelectRight
   #define TMSetLeft _TMSetLeft
   #define TMSetRight _TMSetRight
   #define TMSetSession _TMSetSession
   #define TMStatus _TMStatus
   #define TMWrite _TMWrite
   #define TMWriteu _TMWriteu
#endif

#ifndef DLLEntry
   /* Other platforms */
   #define DLLEntry
#endif

DLLEntry void TMCall(char * subrname, short int argc, ...);
DLLEntry char * TMChange(char * src, char * old_string, char * new_string, int occurrences, int start);
DLLEntry void TMClearSelect(int listno);
DLLEntry void TMClose(int fno);
DLLEntry int TMConnect(char * host, int port, char * username, char * password, char * account);
DLLEntry int TMConnected(void);
DLLEntry int TMConnectLocal(char * account);
DLLEntry int TMDcount(char * src, char * delim_str);
DLLEntry char * TMDel(char * src, int fno, int vno, int svno);
DLLEntry void TMDelete(int fno, char * id);
DLLEntry void TMDeleteu(int fno, char * id);
DLLEntry void TMDisconnect(void);
DLLEntry void TMDisconnectAll(void);
DLLEntry void TMEndCommand(void);
DLLEntry char * TMError(void);
DLLEntry char * TMExecute(char * cmnd, int * err);
DLLEntry char * TMExtract(char * src, int fno, int vno, int svno);
DLLEntry char * TMField(char * src, char * delim, int first, int occurrences);
DLLEntry void TMFree(void * p);
DLLEntry int TMGetSession(void);
DLLEntry char * TMIns(char * src, int fno, int vno, int svno, char * new_string);
DLLEntry int TMLocate(char * item, char * src, int fno, int vno, int svno, int * pos, char * order);
DLLEntry void TMMarkMapping(int fno, int state);
DLLEntry int TMMatch(char * str, char * pattern);
DLLEntry char * TMMatchfield(char * str, char * pattern, int component);
DLLEntry int TMOpen(char * filename);
DLLEntry char * TMRead(int fno, char * id, int * err);
DLLEntry char * TMReadl(int fno, char * id, int wait, int * err);
DLLEntry char * TMReadList(int listno);
DLLEntry char * TMReadNext(short int listno);
DLLEntry char * TMReadu(int fno, char * id, int wait, int * err);
DLLEntry void TMRelease(int fno, char * id);
DLLEntry char * TMReplace(char * src, int fno, int vno, int svno, char * new_string);
DLLEntry char * TMRespond(char * response, int * err);
DLLEntry void TMSelect(int fno, int listno);
DLLEntry void TMSelectIndex(int fno, char * indexname, char * indexvalue, int listno);
DLLEntry char * TMSelectLeft(int fno, char * indexname, int listno);
DLLEntry char * TMSelectRight(int fno, char * indexname, int listno);
DLLEntry void TMSetLeft(int fno, char * indexname);
DLLEntry void TMSetRight(int fno, char * indexname);
DLLEntry int TMSetSession(int session);
DLLEntry int TMStatus(void);
DLLEntry void TMWrite(int fno, char * id, char * data);
DLLEntry void TMWriteu(int fno, char * id, char * data);


/* Server error status values */

#define SV_OK             0    /* Action successful                       */
#define SV_ON_ERROR       1    /* Action took ON ERROR clause             */
#define SV_ELSE           2    /* Action took ELSE clause                 */
#define SV_ERROR          3    /* Action failed. Error text available     */
#define SV_LOCKED         4    /* Action took LOCKED clause               */
#define SV_PROMPT         5    /* Server requesting input                 */

/* END-CODE */
